<?php

namespace Amis\functions;

class Button extends Actions
{
    public string $type = 'button';

    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    public function url($url)
    {
        $this->url = $url;
        return $this;
    }

    public function size($type = '')
    {
        if (in_array($type, ['xs', 'sm', 'md', 'lg'])) {
            $this->size = $type;
        }
        return $this;
    }

    public function actionType($type = 'button')
    {
        $this->actionType = $type;
        return $this;
    }

    public function level($type = 'default')
    {
        if (in_array($type, ['link', 'primary', 'enhance', 'secondary', 'info', 'success', 'warning', 'danger', 'light', 'dark', 'default'])) {
            $this->level = $type;
        }
        return $this;
    }

    public function tooltip($type = '')
    {
        if (in_array($type, ['string', 'TooltipObject'])) {
            $this->tooltip = $type;
        }
        return $this;
    }

    public function tooltipPlacement($type = 'top')
    {
        if (in_array($type, ['top', 'right', 'bottom', 'left'])) {
            $this->tooltipPlacement = $type;
        }
        return $this;
    }

    public function tooltipTrigger($type = '')
    {
        if (in_array($type, ['hover', 'focus'])) {
            $this->tooltipTrigger = $type;
        }
        return $this;
    }

    public function disabled(bool $disabled = false)
    {
        $this->disabled = $disabled;
        return $this;
    }

    public function block(bool $block = false)
    {
        $this->block = $block;
        return $this;
    }

    public function loading(bool $loading = false)
    {
        $this->loading = $loading;
        return $this;
    }

    public function loadingOn(bool $loadingOn = false)
    {
        $this->loadingOn = $loadingOn;
        return $this;
    }
}
